<?php 
$user=$session->read('User');
//print_r($user);
$companyid=$session->read("companyid");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
		<?php 
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
    	</h2>
    	<div class='clear'></div>
    </div>
    <div class="right item_add_btn">
		<?php 
    		echo $html->link("返回","/companys/otherdeclare/",array("onclick"=>"history.go(-1);return false;"));
    	?>
	</div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<div class="details_item_line">
			<div class="details_item">
				<div class="form_left_title left">项目名称：</div>
			   	<div class="form_right_input  left">
			    	<?php echo $other['CompOtherdeclare']['name'];?>
			    </div>
			</div>
		</div>
	
		<!--<div class="details_item_line">
			<div class="details_item">
				<div class="form_left_title left">主管部门：</div>
				<div class="form_right_input left">
				<?php 
                    echo $str->getkeystr($other['CompOtherdeclare']['department'],$otrdecltype);
                ?>
				</div>
			</div>
		</div>
	
		--><div class="details_item_line">
		<div class="details_item">
				<div class="form_left_title left">级别：</div>
			   	<div class="form_right_input  left">
			    	<?php echo $other['CompOtherdeclare']['level'];?>
			    </div>
			</div>
			<div class="details_item">
				<div class="form_left_title left">部门：</div>
			   	<div class="form_right_input  left">
			    	<?php echo $other['CompOtherdeclare']['branch'];?>
			    </div>
			</div>
			<div class="details_item">
			    <div class="form_left_title left">资助金额：</div>
			    <div class="form_right_input form_date_picker left">
			    	<?php echo $other['CompOtherdeclare']['fund'];?> 万元
			    </div>
			</div>
		</div>
		<div class="details_item_line">
			<div class="details_item">
				<div class="form_left_title left">申报类型：</div>
			   	<div class="form_right_input  left">
			    	<?php echo $other['CompOtherdeclare']['type'];?>
			    </div>
			</div>
			<div class="details_item">
			    <div class="form_left_title left">申报状态：</div>
			    <div class="form_right_input left">
			    <?php 
			    	echo $str->getkeystr($other['CompOtherdeclare']['status'],$dstatus)
                ?>
                </div>		               		
			</div>
		</div>
		<div class="details_item_line">
			<div class="details_item">
			    <div class="form_left_title left">申报时间：</div>
			    <div class="form_right_input form_date_picker left">
			    	<?php 
			    	$project_time=$other["CompOtherdeclare"]["project_time"];
					if($project_time){
					 $project_time = date("Y-m-d",strtotime($project_time));
					}else{
						$project_time = "";
					}
			    	echo $project_time;
			    	?>
			    </div>
			</div>
			<div class="details_item">
			    <div class="form_left_title left">立项时间：</div>
			    <div class="form_right_input form_date_picker left">
			    	<?php 
			    	$project_time=$other["CompOtherdeclare"]["project_time"];
					if($project_time){
					 $project_time = date("Y-m-d",strtotime($project_time));
					}else{
						$project_time = "";
					}
					echo $project_time;
					?>
			    </div>
			</div>
			<div class="details_item">
			    <div class="form_left_title left">考核时间：</div>
			    <div class="form_right_input form_date_picker left">
			    	<?php 
			    	$assessment_time=$other["CompOtherdeclare"]["assessment_time"];
					if($assessment_time){
						$assessment_time = date("Y-m-d",strtotime($assessment_time));
					}else{
						$assessment_time = "";
					}
			    	echo $assessment_time;
			    	?>
			    </div>
			</div>
		</div>
		
		<?php 
		$i = 0;
		foreach($filetypes as $key=>$ftype){
			$i++;
			if(($i%2) == 1){
				echo "<div class='details_item_line'><div class='details_item'>";
			}else{
				echo "<div class='details_item'>";
			}
		?>
		    <div class="form_left_title left"><?php echo $ftype?>：</div>
		    <div class="form_right_input left">
	    	<?php 
	    		$attachments = $other['Attachment'];
        	 	$fildisplay="暂无文件";
         		if(!empty($attachments)){
					foreach($attachments as $attachment) {
						if($key==$attachment["cvid"]){
							$fildisplay="";
						}
					}
				}
			 ?>
                <div class="file_category_list">
        		<div id="filelist<?php echo $key?>" class="file_lists">
      				<ul class="picture_attach">
        				<?php
        				if(!empty($attachments)){
		                	$dan="'";
		                	$flag=$action->checkPermissions($user,$companyid);
        					echo $fildisplay;
	                		foreach($attachments as $attachment){
	                			$fname=$attachment["file_name"];
	                			$fpath=$attachment["file_path"];
	                			$fid=$attachment["id"];
	                			$createdtime=date("Y-m-d",strtotime($attachment["created"]));
	                			$isimg=$str->checkimg($fname);
	                			if($isimg && $key==$attachment["cvid"]){
									echo "<li>";
									echo '<div class="picture_info">';
									echo "<span>".$fname."</span>";
									echo "<span class='source_upload_date'>".$createdtime.$html->link("下载",'/projects/download/'.$attachment["id"],null)."</span>";
									echo "</div>";
									
									//if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id'])
									$istype=$action->checktype($user,$usertype);
									print($istype);
									if($user['usertype']!='2' && $user['usertype']!='3')
									{
										echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.','.$dan.$key.$dan.')" href="javascript:void(0)"></a></span>';
									}
									$img=$html->image("/".$fpath);
									echo "<span>".$html->link($img,'javascript:void(0);',array('onclick'=>"openimg(".$dan."f".$fid.$dan.")",'escape' => false))."</span>";
									echo "<div style='display:none' id='f".$fid."' title='".$fname."'>".$img."</div>";
									
									echo "</li>";
								}
							}
	                	?>
        				<div class="clear"></div>
        			</ul>
        			<ul class="file_attach">
	                <?php
	                	foreach($attachments as $attachment){
                			$fname=$attachment["file_name"];
                			$isimg=$str->checkimg($fname);
                			if(!$isimg && $key==$attachment["cvid"]){
								echo "<li>";
								echo "<span>".$html->link($fname,'/projects/download/'.$attachment["id"],null)."</span>";
								echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
								//if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id'])
								if($user['usertype']!='2' && $user['usertype']!='3')
								{
									echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.','.$dan.$key.$dan.')" href="javascript:void(0)"></a></span>';
								}
								echo "</li>";
							}
						}
					}
	                ?>
	                	<div class="clear"></div>
	                </ul>
                </div>
            </div>
	 	</div>
		<?php
			if(($i%2) == 1){
				echo "</div>";
			}else{
				echo "</div></div>";
			}
		 }
		?>
		</div>
	</div>
</div>
<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>